package org.rcloud.io.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import org.rcloud.io.Utils.ResultVo;
import org.rcloud.io.model.Mapvs;
import org.rcloud.io.service.MapvsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2019/2/26.
 */
@RestController
@RequestMapping(value = "/map")
public class MapvsController {
    @Autowired
    private MapvsService mapvsService;

    /*
    * 查询
    *
    * */
    @RequestMapping(value = "/select", produces = {"application/json;charset=UTF-8"})
    public ResultVo select(@RequestBody String params) {
        Mapvs mapvs = JSON.parseObject(params,Mapvs.class);
        return mapvsService.selectByPrimaryKey(mapvs);
    }

    /*
    * 根据经纬度查询（经纬度参数）
    *
    * */
    @RequestMapping(value = "/mapByOther", produces = {"application/json;charset=UTF-8"})
    public PageInfo<Mapvs> mapByOther(@RequestBody JSONObject params) {//只是JSONObject的别名，也可以写sss
        PageInfo<Mapvs> pageInfo = mapvsService.mapByOther(params);
        return pageInfo;

    }
}
